import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Leet187 {
    public static void main(String[] args) {
        Leet187 l = new Leet187();
        System.out.println(l.findRepeatedDnaSequences("AAAAAAAAAAA"));
    }
    public List<String> findRepeatedDnaSequences(String s) {
        Set<String> set = new HashSet<>();
        Set<String> re = new HashSet<>();
        for (int i = 0; i < s.length() - 9; i++) {
            String str = s.substring(i,i+10);
            if (!set.contains(str))
                set.add(str);
            else re.add(str);
        }
        return new ArrayList<>(re);
    }
}
